package com.caijb.thread;

/**
 * @author caijb
 * @version 1.0
 * @data 2025/10/30 22:04
 */
public class UserThreadLocal {

    private static final ThreadLocal<String> USER_THREAD_LOCAL = new ThreadLocal<>();

    private static final InheritableThreadLocal<String> INHERITABLE_THREAD_LOCAL = new InheritableThreadLocal<>();

    public static void remove() {
        USER_THREAD_LOCAL.remove();
    }

    public static void set(String user) {
        USER_THREAD_LOCAL.set(user);
    }
    public static String get() {
        return USER_THREAD_LOCAL.get();
    }

    public static void setInheritable(String user) {
        INHERITABLE_THREAD_LOCAL.set(user);
    }
    public static String getInheritable() {
        return INHERITABLE_THREAD_LOCAL.get();
    }
    public static void removeInheritable() {
        INHERITABLE_THREAD_LOCAL.remove();
    }
}
